package cn.com.xy.sms.sdk.db.entity;

import android.content.ContentValues;
import android.database.Cursor;

/**
 * Created by admin on 2016/11/24.
 */

public class MovielMessageItem {
    private long id;
    private String movieName;
    private String data;
    private long hasData;//0代表数据正常，非0为异常
    private long date;

    public long getHasData() {
        return hasData;
    }

    public void setHasData(long hasData) {
        this.hasData = hasData;
    }

    public MovielMessageItem() {
        this.date = System.currentTimeMillis();
    }

    public MovielMessageItem setData(String data) {
        this.data = data;
        return this;
    }

    public String getMovieName() {
        return movieName;
    }

    public void setMovieName(String moviename) {
        this.movieName = moviename;
    }

    public MovielMessageItem setDate(long date) {
        this.date = date;
        return this;
    }

    public String getData() {
        return data;
    }

    public long getDate() {
        return this.date;
    }

    public MovielMessageItem(Cursor cursor) {
        this.id = Long.parseLong(cursor.getString(cursor.getColumnIndex(MovieMessageManager.KEY_ID)));
        this.data = cursor.getString(cursor.getColumnIndex(MovieMessageManager.KEY_DATA));
        this.movieName = cursor.getString(cursor.getColumnIndex(MovieMessageManager.KEY_NAME));
        this.date = Long.parseLong(cursor.getString(cursor.getColumnIndex(MovieMessageManager.KEY_DATE)));
        this.hasData = Long.parseLong(cursor.getString(cursor.getColumnIndex(MovieMessageManager.KEY_HASDATA)));
    }

    public ContentValues getContentValues() {
        ContentValues values = new ContentValues();

        values.put(MovieMessageManager.KEY_NAME, this.movieName);
        values.put(MovieMessageManager.KEY_HASDATA, this.hasData);
        values.put(MovieMessageManager.KEY_DATE, this.date);
        values.put(MovieMessageManager.KEY_DATA, this.data);

        return values;
    }
}
